<template>
  <div id="app">
    <transition
      mode="in-out"
      keep-alive
    >
      <router-view v-wechat-title="$route.meta.title"></router-view>
    </transition>
  </div>
</template>

<script>
require("../wechat/static/util/fix-screen.js");
let CONSTANT = require("../wechat/static/constant/urlconstant.js"),
  wsService = require("../wechat/static/common/wechat-jsdk.js"),
  common = require("../wechat/static/common/common.js");

export default {
  name: "app",
  data() {
    return {};
  },
  watch: {
    
  },
  mounted() {
    let sessionId = this.$route.query.sessionid
    if(sessionId){
      common.setCookie('sessionId',decodeURI(sessionId))
      return
    }
    let hrefUrl = location.href;
    if(hrefUrl.includes('H5test')||hrefUrl.includes('localhost')){
      this.getSession()
    }else{
      sessionId = jsInterface.getShopSessionId()
      common.setCookie('sessionId',sessionId)
    }
  },
  methods: {
    getSession(){
       let url = CONSTANT.LIST.appUser;
      common.login(url, "13428982992", res => {
        if (res.code == 200) {
          let sessionId =  res.data.bussData.sessionId
          common.setCookie('sessionId',sessionId)
        }
      });
    }
  }
};
</script>

<style lang="less">
@import "~vux/src/styles/reset.less";
@import "styles/common.less";
@media screen and (min-width: 640px) {
  html {
    font-size: 18px;
  }
}
body,
html,
#app {
  height: 100%;
  font-family: PingFang-SC-Regular;
  font-size: 12px;
  -webkit-overflow-scrolling: touch;
  &::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
  }
}
.weui-icon_toast.weui-loading {
  display: block !important;
  margin: 30px auto 0 !important;
}
img {
  height: auto;
  -webkit-user-select: none;
  user-select: none;
}

.read {
  div {
    -webkit-user-select: none;
    -moz-user-select: none;
    -o-user-select: none;
    user-select: none;
  }
}

.over-hidden {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vux-icon-dot.active {
  background: #038fff !important;
}

.weui-cells.vux-search_show {
  min-height: 100%;
}

.weui-dialog__hd {
  /*padding: 0rem!important;*/
}

.weui-dialog {
  /*top: 45%!important;*/
}

.common_p {
  font-size: 0.18rem;
  transform: scale(0.9);
  font-weight: 400;
}

input,
textarea {
  border: none;
  text-shadow: none;
  -webkit-appearance: none;
  -webkit-user-select: text;
  outline-color: transparent;
  box-shadow: none;
  padding: 0.23rem 0.52rem;
  font-size: 0.32rem;
  border-bottom: 1px solid #e1e1e1;
  overflow: hidden;
  box-shadow: none;
  font-family: SimHei;
  &:focus {
    outline: none;
    border: 1px solid #238af3;
  }
}
.good-container{
  .detail{
    span{
      display: initial;
    }
  }
}
input:focus,
textarea:focus {
  border: none;
}

.fixed-speed {
  position: fixed;
  right: 0;
  bottom: 2.53rem !important;
  z-index: 3;
}

input:-webkit-autofill,
select:-webkit-autofill {
  -webkit-box-shadow: 0 0 0px 1000px white inset !important;
}

ul,
li {
  list-style: none;
}

a {
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

.flex-cont {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-box-justify {
  display: flex;
  justify-content: center;
}

.flex-box-align {
  display: flex;
  align-items: center;
}

.flex-box {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.flex-box-container {
  display: flex;
  flex-wrap: wrap;
}

.flex {
  flex: 1;
}

.select-icon-wrapper {
  .select-icon {
    width: .26rem;
    height: .26rem;
    border-radius: 50%;
    border: .02rem solid #ccc;
  }
  .selected-icon {
    width: .26rem;
    height: .26rem;
    border-radius: 50%;
    background-color: #FF7268;
    position: relative;
    border: .02rem solid #FF7268;
    &:after {
      content: "";
      width: .08rem;
      height: .14rem;
      border: .02rem solid #fff;
      border-top: 0;
      border-left: 0;
      position: absolute;
      top: 50%;
      left: 50%;
      color: #fff;
      /*font-size: 20rem;*/
      transform: translate(-50%, -60%) rotate(45deg);
      transform-origin: 50%;
    }
  }
}

.weui-toast {
  min-height: 2.5rem !important;
  min-width: 2.5rem !important;
  width: auto !important;
  height: auto;
}
.weui-tabbar {
  background-color: #fff !important;
}

.weui-btn.weui-btn_primary {
  background-color: #2499ca !important;
  border-radius: 30px !important;
  height: 0.88rem;
  line-height: 0.88rem;
}
//公共
.box {
  display: -webkit-box;
  display: box;
  display: -moz-box;
  /* 老版本 - 适配iOS 6-, Safari 3.1-6 */
  display: -webkit-flex;
  /* 新版本 - 适配Chrome */
  display: flex;
}

.weui-btn:after {
  border: none !important;
}

//动画效果
@keyframes bounce-in {
  0% {
    transform: scale(0);
  }
  100% {
    transform: scale(1);
  }
}

.mb10 {
  .main .el-form-item {
    margin-bottom: 10px;
  }
}

.w80 {
  .avatar-uploader .el-upload .avatar-uploader-icon {
    width: 80px;
    height: 80px;
    line-height: 78px;
  }
  .avatar-uploader .el-upload .avatar {
    width: 80px;
    height: 80px;
    line-height: 78px;
  }
  .el-upload.el-upload--picture-card,
  .el-upload-list--picture-card .el-upload-list__item {
    width: 80px;
    height: 80px;
    line-height: 78px;
  }
}
</style>
